import java.util.List;
import java.util.Arrays;

public class problem38 {
    public static void main(String[] args) {
        Long[] pandigitals = ProjectEuler.getPandigitals(123456789L);
        List<Long> pandigitalList = Arrays.asList(pandigitals);

        Long number = 0L;
        Long counter = 1L;
        Long sum = 0L;
        do {
            Long counter2 = 0L;
            do {
                counter2++;
                sum = new Long(sum.toString() + ((Long)(counter * counter2)).toString());
            } while(sum.toString().length() < 10 && !pandigitalList.contains(sum));
            if(pandigitalList.contains(sum)) {
                number = sum;
                System.out.println(number + " => " + counter + "(1.." + counter2 + ")");
            }
            sum = 0L;
            counter++;
        } while(counter.toString().length() < 10);
        System.out.println(number);
    }
}
